package com.cv.属性赋值;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;

/**
 * @Auther: 代理仁
 * @Date: 2019/7/9 23:22
 * @Description:赋值类
 * @Value:1.基本数值 布尔等 2.Spel表达式 #{} 3.${} 读取配置文件的值(必须要把配置文件加载进来:通过配置文件或@PropertySource)
 */
public class Song {
    @Value("#{30-4}")
    private int age;
    @Value("${song.name}")
    private String name;
    @Value("1")
    private int sex;

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    @Override
    public String toString() {
        return "Song{" +
                "age=" + age +
                ", name='" + name + '\'' +
                ", sex=" + sex +
                '}';
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getSex() {
        return sex;
    }

    public void setSex(int sex) {
        this.sex = sex;
    }
}
